Skip to content

Converted coroutines to futures#36

Open
Bilge wants to merge 5 commits intoamphp:masterfrom
Bilge:v1
Open

Converted coroutines to futures#36
Bilge wants to merge 5 commits intoamphp:masterfrom
Bilge:v1

Conversation

@Bilge
Copy link
Contributor

@Bilge Bilge commented Oct 18, 2022

To be released as 🏷️ 1.0.0. Obviates #35.

📝 Running the examples seems to throw exceptions on connection close. This is somehow not captured by any of the tests (which are all passing).

@Bilge Bilge changed the title Converted coroutines to fibers Converted coroutines to futures Oct 18, 2022
@Bilge Bilge force-pushed the v1 branch 8 times, most recently from 0ffd9fd to 6051009 Compare October 18, 2022 19:38
Bilge added 5 commits October 18, 2022 21:02
Upgraded PHP-CS-Fixer v2 -> v3.
Removed position_after_functions_and_oop_constructs=>same CS rule (reverting to PSR-2).
Added some return types.
"psr_autoloading" => true,
"return_type_declaration" => ["space_before" => "none"],
"short_scalar_cast" => true,
"single_blank_line_before_namespace" => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use our shared config in amphp/php-cs-fixer-config:^2, see https://github.com/amphp/amp/blob/d048ec1d03d47fc313d630e989b7a73053f10fae/.php-cs-fixer.dist.php

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be that as it may, I do not think this issue needs to hold up this PR, nor even the 1.0 release, since styles can just be fixed after the fact.

Comment on lines +10 to +12
/**
* @var System $systemStats
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need such comments any longer, because we use proper types instead of generics inside promises.

<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./vendor/autoload.php" colors="true">
<phpunit colors="true">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this now automatically included?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall a time when it was not. PHPUnit should be launched with bin/phpunit. If you invoke it correctly, it will always include the autoloader. Perhaps if you're one of these people that thinks installing PHPUnit as a global PHAR is a good idea then it might not, but even that is probably no longer the case these days.


/** @var string */
private $tube;
private ?string $tube;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need = null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. This is your library, after all. I was hoping I would not need to work on it any more and you could just commit directly to this branch if you want to make changes. I'm not going to protest any change you want to make so just go ahead.

}

public function put(string $payload, int $timeout = 60, int $delay = 0, $priority = 0): Promise {
public function put(string $payload, int $timeout = 60, int $delay = 0, $priority = 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add return types to all of these.

Copy link
Contributor Author

@Bilge Bilge Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the return types are. In most cases it seems they would just be mixed anyway. But in principal I agree, as long as we're absolutely sure what the types are and that they're invariant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants